<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>工作流审批界面</title>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/jquery-ui-inc.jsp"%>
<script type="text/javascript" src="${ctx}/js/zbxtools.js"></script>
<script type="text/javascript">
	var inputForm = '#inputForm';
	$(function(){
		$(inputForm).form({
		    success:function(data){
		    	var result = jQuery.parseJSON(data);
		    	if(result.flag=='T'){
		    		$.messager.alert('提交结果', result.msg, 'info',function(){
		    			parent.closeAddWin();// 关闭添加窗口
		    			parent.reload();// 刷新列表
		    		});
		    	}else{
		    		$.messager.alert('提交结果', result.msg, 'error');
		    	}        
		    },
		    error:function(messg)  { 
	       	    $.messager.alert('错误提示', '与服务器连接异常', 'error');
	       }  
		});
	});
	
	//执行表单提交操作
	function doSubmit(){
		var flag = $(inputForm).form('validate');
		if(flag){
		    var taskParams = $("#task_params").val();
	        var urlStr = "${ctx}/flow/core/flow-test!approve.action?"+taskParams;
	        alert(urlStr);
		    $(inputForm).attr("action",urlStr);
			$(inputForm).submit();
		}
	}
</script>
</head>
<body>	
<div id="tip"> </div>
		<form id="inputForm" name="inputForm" method="post" >
			<input type="hidden" name="taskId" id="taskId" value="${taskId}"/>
			<input type="hidden" name="processInstanceId" id="processInstanceId" value="${processInstanceId}"/>
			<table class="datagrid-body" style="font-size: 14px;width: 100%">
			<tr>
				<td class="datagrid-header">任务Id:</td>
				<td>
					<span>${taskId}</span>
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">实例Id:</td>
				<td>
					<span>${processInstanceId}</span>
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">审批结果:<font color=red>*</font></td>
				<td>
					<input type="radio" name="result"  checked="checked" value="T">通过
					<input type="radio" name=result value="F"> 不通过
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">传递参数(携带参数,多个<br>用&分隔,例如 a=1&b=2):<font color=red>*</font></td>
				<td>
					<input type="text" id="task_params" >
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">审批意见:<font color=red>*</font></td>
				<td>
					<textarea rows="3" cols="30" name="approveMsg"></textarea>
				</td>
			</tr>
			<tr>
				<td class="datagrid-header"></td>
				<td >	
					<a href="#" class="easyui-linkbutton" id="bt1" iconCls="icon-save" onclick="doSubmit();">提交</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="parent.closeAddWin();"; >取消</a>	
				</td>
			</tr>
			</table>
		</form>
</body>
</html>
